package com.easy.api.factory.api.request;

import com.easy.api.http.HttpUtils;
import com.easy.api.utils.JsonUtils;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Map;

/**
 * @Author liuyuan
 * @Date 2020-04-24 09:41
 * @Version 1.0
 */
@Component("getApiMapping")
public class GetApiMapping extends HeaderRequest {


    @Override
    public Object requestStrategy(Object param) throws IOException {
        Map<String, String> requestParam = buildRequestParam(param);
        String result = HttpUtils.get(requestUrl, requestParam, "UTF-8");
        return JsonUtils.fromJson(result, method.getReturnType());
    }
}
